#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;

void commul(int a, int b, size_t* minnum, int* maxnum)
{
    if (a > b)
    {
        swap(a, b);
    }
    size_t num = 0;
    for (int i = 1; i <= a; i++)
    {
        if (a % i == 0 && b % i == 0 && i != 1)
        {
            *maxnum *= i;
            num = (*maxnum) * (a / i) * (b / i);
         
            *minnum = min(*minnum, num);
            commul(a / i, b / i, minnum, maxnum);
            break;
        }

    }
}

int main() {
    int a = 100000, b= 100000;
    //cin >> a >> b;
    size_t minnum = a * b;
    cout << minnum << endl;
    int maxnum = 1;
    commul(a, b, &minnum, &maxnum);
    cout << minnum << endl;
}